<?php

use App\Http\Controllers\Api\CommonController;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\Api\LogController;
use App\Http\Controllers\Api\RoleController;
use App\Http\Controllers\Api\TestController;
use App\Http\Controllers\Api\LoginController;
use App\Http\Controllers\Api\UsersController;
use App\Http\Controllers\Api\UploadController;
use App\Http\Controllers\Api\ModuleController;
use App\Http\Controllers\Api\StorageController;
use App\Http\Controllers\Api\PackageController;
use App\Http\Controllers\Api\MaterielController;
use App\Http\Controllers\Api\SystemConfigController;
use App\Http\Controllers\Api\CommonDetailController;
use App\Http\Controllers\Api\MaterielTypeController;
use App\Http\Controllers\Api\MaterielClassController;
use App\Http\Controllers\Api\StorageManageController;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

//Route::middleware('auth:api')->get('/user', function (Request $request) {
//    return $request->user();
//});

Route::post('test', [TestController::class, 'test']);
Route::post('token', [TestController::class, 'token']);
Route::post('push', [TestController::class, 'push']);

//登录部分
Route::post('send_code', [LoginController::class, 'sendCode']);//发送验证码
Route::post('login', [LoginController::class, 'login']);//账号登录

//login_limit
Route::group(['middleware'=>[]],function(){
    //子账号管理
    Route::post('user_list', [UsersController::class, 'userList']);//子账号列表
    Route::post('trans_status', [UsersController::class, 'transStatus']);//启禁用账号状态
    Route::post('reset_pwd', [UsersController::class, 'resetPwd']);//重置子账号密码
    Route::post('del_user', [UsersController::class, 'delUser']);//删除子账号
    Route::post('add_user', [UsersController::class, 'addUser']);//新建子账号
    Route::post('edit_user_info', [UsersController::class, 'editUserInfo']);//修改子账号基础信息
    Route::post('set_user_permission', [UsersController::class, 'setUser']);//设置子账号权限信息
    Route::post('get_user_permission', [UsersController::class, 'getUserPermission']);//获取子账号权限信息

    //账户-设置
    Route::post('change_mobile', [UsersController::class, 'changeMobile']);//修改手机号
    Route::post('modify_userinfo', [UsersController::class, 'modifyUserinfo']);//修改用户信息
    Route::post('change_password', [UsersController::class, 'changePassword']);//修改密码
    Route::post('user_center', [UsersController::class, 'userCenter']);//个人中心
    Route::post('relieve_wechat_bind', [UsersController::class, 'relieveWechatBind']);//解除微信绑定
    Route::post('wechat_bind', [UsersController::class, 'wechatBind']);//绑定微信
    Route::post('invite_list', [UsersController::class, 'inviteList']);//被邀请人列表

    //角色管理
    Route::post('role_add', [RoleController::class, 'add']);//添加角色
    Route::post('role_del', [RoleController::class, 'del']);//删除角色
    Route::post('role_edit', [RoleController::class, 'edit']);//修改角色信息及权限信息
    Route::post('role_list', [RoleController::class, 'list']);//角色列表
    Route::post('role_detail', [RoleController::class, 'detail']);//角色权限详细

    //模块管理
    Route::post('add_module', [ModuleController::class, 'add']);//增加
    Route::post('del_module', [ModuleController::class, 'del']);//删除
    Route::post('edit_module', [ModuleController::class, 'edit']);//修改
    Route::post('module_list', [ModuleController::class, 'list']);//权限信息列表
    Route::post('module_select', [ModuleController::class, 'select']);//一级权限模块列表-下拉

    //操作日志
    Route::post('log_list', [\App\Http\Controllers\Api\OperationLogController::class, 'logList']);
    Route::post('sync_data', [\App\Http\Controllers\Api\SyncDataController::class, 'syncData']);//同步数据
    Route::post('sync_storage_manage', [\App\Http\Controllers\Api\SyncDataController::class, 'syncStorageManage']);//同步在库物料信息
    Route::post('sync_account', [\App\Http\Controllers\Api\SyncDataController::class, 'SyncAccount']);//同步user表中信息至admin表
    Route::post('sync_storage_manager', [\App\Http\Controllers\Api\SyncDataController::class, 'SyncStorageManager']);//更新库存表中原有的user_id为同步后的user_id
    Route::post('sync_materiel', [\App\Http\Controllers\Api\SyncDataController::class, 'SyncMateriel']);//更新采购表中原有的user_id为同步后的user_id
    Route::post('sync_package', [\App\Http\Controllers\Api\SyncDataController::class, 'SyncPackage']);//同步套餐数据

    //供应商客户
    Route::post('supplier_customer_add', [\App\Http\Controllers\Api\SupplierCustomerController::class, 'add']);
    Route::post('supplier_customer_edit', [\App\Http\Controllers\Api\SupplierCustomerController::class, 'edit']);
    Route::post('supplier_customer_del', [\App\Http\Controllers\Api\SupplierCustomerController::class, 'del']);
    Route::post('supplier_customer_list', [\App\Http\Controllers\Api\SupplierCustomerController::class, 'index']);
    Route::post('supplier_customer_find', [\App\Http\Controllers\Api\SupplierCustomerController::class, 'find']);
    Route::post('supplier_customer_select', [\App\Http\Controllers\Api\SupplierCustomerController::class, 'select']);

    //报溢报损
    Route::post('overflow_breakage_add', [\App\Http\Controllers\Api\OverflowBreakageController::class, 'add']);
    Route::post('overflow_breakage_edit', [\App\Http\Controllers\Api\OverflowBreakageController::class, 'edit']);
    Route::post('overflow_breakage_repeal', [\App\Http\Controllers\Api\OverflowBreakageController::class, 'repeal']);//撤销
    Route::post('overflow_breakage_list', [\App\Http\Controllers\Api\OverflowBreakageController::class, 'index']);
    Route::post('overflow_breakage_detail', [\App\Http\Controllers\Api\OverflowBreakageController::class, 'detail']);

    //公司行业
    Route::post('company_class_list', [\App\Http\Controllers\Api\CompanyClassController::class, 'index']);
    Route::post('company_class_add', [\App\Http\Controllers\Api\CompanyClassController::class, 'add']);
    Route::post('company_class_edit', [\App\Http\Controllers\Api\CompanyClassController::class, 'edit']);
    Route::post('company_class_del', [\App\Http\Controllers\Api\CompanyClassController::class, 'del']);

    //记账类型
    Route::post('tally_class_list', [\App\Http\Controllers\Api\TallyClassController::class, 'index']);
    Route::post('tally_class_add', [\App\Http\Controllers\Api\TallyClassController::class, 'add']);
    Route::post('tally_class_edit', [\App\Http\Controllers\Api\TallyClassController::class, 'edit']);
    Route::post('tally_class_del', [\App\Http\Controllers\Api\TallyClassController::class, 'del']);

    Route::post('approver_list', [UsersController::class, 'approverList']);//审批人列表

    //我的仓库
    Route::post('storage_list', [StorageController::class, 'storageList']);//仓库列表
    Route::post('storage_select', [StorageController::class, 'storageSelect']);//仓库列表-下拉框
    Route::post('create_storage', [StorageController::class, 'add']);//创建仓库
    Route::post('edit_storage', [StorageController::class, 'edit']);//修改仓库
    Route::post('del_storage', [StorageController::class, 'delete']);//修改仓库

    //物料分类管理
    Route::post('materiel_class_select', [MaterielClassController::class, 'select']);
    Route::post('materiel_class_list', [MaterielClassController::class, 'index']);
    Route::post('materiel_class_add', [MaterielClassController::class, 'add']);
    Route::post('materiel_class_del', [MaterielClassController::class, 'del']);
    Route::post('materiel_class_edit', [MaterielClassController::class, 'edit']);
    Route::post('materiel_class_rand_no', [MaterielClassController::class, 'randCode']);

    //物料类型管理
    Route::post('materiel_type_add', [MaterielTypeController::class, 'add']);//新建物料类型信息
    Route::post('materiel_type_del', [MaterielTypeController::class, 'del']);//删除指定物料类型信息
    Route::post('materiel_type_edit', [MaterielTypeController::class, 'edit']);//修改指定物料信息
    Route::post('materiel_type_rand_no', [MaterielTypeController::class, 'randCode']);//物料类型随机编号
    Route::post('materiel_type_info', [MaterielTypeController::class, 'info']);//物料类型详细信息
    Route::post('materiel_type_list', [MaterielTypeController::class, 'materielTypeList']);//物料类型列表
    Route::post('materiel_type_select', [MaterielTypeController::class, 'materielTypeSelect']);//物料类型下拉列表

    Route::post('upload_file', [UploadController::class, 'upload']);//单图上传

    //司机
    Route::post('driver_list', [\App\Http\Controllers\Api\DriverController::class, 'index']);
    Route::post('driver_find', [\App\Http\Controllers\Api\DriverController::class, 'find']);
    Route::post('driver_add', [\App\Http\Controllers\Api\DriverController::class, 'add']);
    Route::post('driver_edit', [\App\Http\Controllers\Api\DriverController::class, 'edit']);
    Route::post('driver_del', [\App\Http\Controllers\Api\DriverController::class, 'del']);
    Route::post('driver_select', [\App\Http\Controllers\Api\DriverController::class, 'select']);

    //版本
    Route::post('version_list', [\App\Http\Controllers\Api\VersionsController::class, 'index']);
    Route::post('version_add', [\App\Http\Controllers\Api\VersionsController::class, 'add']);
    Route::post('version_edit', [\App\Http\Controllers\Api\VersionsController::class, 'edit']);
    Route::post('version_del', [\App\Http\Controllers\Api\VersionsController::class, 'del']);
    Route::post('version_find', [\App\Http\Controllers\Api\VersionsController::class, 'find']);

    //套餐
    Route::post('package_list', [PackageController::class, 'list']);//套餐列表
    Route::post('add_package_or_content', [PackageController::class, 'add']);//新建套餐或套餐内容
    Route::post('del_package_or_content', [PackageController::class, 'del']);//删除套餐或套餐内容
    Route::post('content_list', [PackageController::class, 'contentList']);//套餐内容列表
    //Route::post('package_edit', [PackageController::class, 'edit']);//修改套餐
    Route::post('edit_package_or_content', [PackageController::class, 'edit']);//修改套餐或套餐内容
    Route::post('package_detail', [PackageController::class, 'detail']);//套餐详情
    Route::post('package_storage_list', [PackageController::class, 'packageStorageList']);//指定套餐内容对应的在库信息列表(修改套餐内容用)
    Route::post('package_content_add', [PackageController::class, 'packageContentAdd']);//添加套餐内容
    Route::post('package_content_select', [PackageController::class, 'packageContentSelect']);//添加套餐内容-可用库存物料信息
    Route::post('package_out', [PackageController::class, 'packageOut']);//套餐出库

    //库存查看
    Route::post('storage_manage_list', [StorageManageController::class, 'list']);//库存列表
    Route::post('storage_manage_import', [CommonController::class, 'import']);//导入库存报表
    Route::post('in_storage', [StorageManageController::class, 'inStorage']);//入库
    Route::post('direct_in_storage', [StorageManageController::class, 'directInStorage']);//直接入库
    Route::post('direct_out_storage', [StorageManageController::class, 'directOutStorage']);//直接出库
    Route::post('set_alert_num', [StorageManageController::class, 'setAlertNum']);//设置低库存预警数
    Route::post('del_storage_manage', [StorageManageController::class, 'del']);//删除
    Route::post('allocate', [StorageManageController::class, 'allocate']);//调拨

    //记账
    Route::post('tally_list', [\App\Http\Controllers\Api\TallyController::class, 'index']);
    Route::post('tally_find', [\App\Http\Controllers\Api\TallyController::class, 'find']);
    Route::post('tally_add', [\App\Http\Controllers\Api\TallyController::class, 'add']);
    Route::post('tally_edit', [\App\Http\Controllers\Api\TallyController::class, 'edit']);
    Route::post('tally_del', [\App\Http\Controllers\Api\TallyController::class, 'del']);

    //销售
    Route::post('sell_list', [\App\Http\Controllers\Api\SellController::class, 'index']);
    Route::post('sell_find', [\App\Http\Controllers\Api\SellController::class, 'find']);
    Route::post('sell_add', [\App\Http\Controllers\Api\SellController::class, 'add']);
    Route::post('sell_edit', [\App\Http\Controllers\Api\SellController::class, 'edit']);
    Route::post('sell_del', [\App\Http\Controllers\Api\SellController::class, 'del']);
    Route::post('sell_repeal', [\App\Http\Controllers\Api\SellController::class, 'repeal']);//撤销
    Route::post('sell_get_money', [\App\Http\Controllers\Api\SellController::class, 'getMoney']);//收款
    Route::post('sell_add_again', [\App\Http\Controllers\Api\SellController::class, 'addAgain']);//重新下单
    Route::post('sell_bind_driver', [\App\Http\Controllers\Api\SellController::class, 'bindDriver']);//司机绑定
    Route::post('sell_find_driver', [\App\Http\Controllers\Api\SellController::class, 'findDriver']);//查看司机
    Route::post('sell_other_charges', [\App\Http\Controllers\Api\SellController::class, 'otherCharges']);//其他费用添加
    Route::post('sell_other_charges_list', [\App\Http\Controllers\Api\SellController::class, 'otherChargesList']);//其他费用添加
    Route::post('sell_other_charges_edit', [\App\Http\Controllers\Api\SellController::class, 'otherChargesEdit']);//其他费用编辑
    Route::post('sell_out', [\App\Http\Controllers\Api\SellController::class, 'out']);//出库

    //退货
    Route::post('sales_return_list', [\App\Http\Controllers\Api\SalesReturnController::class, 'index']);
    Route::post('sales_return_find', [\App\Http\Controllers\Api\SalesReturnController::class, 'find']);

    Route::post('sales_return_add', [\App\Http\Controllers\Api\SalesReturnController::class, 'add']);
    Route::post('sales_return_edit', [\App\Http\Controllers\Api\SalesReturnController::class, 'edit']);
    Route::post('sales_return_del', [\App\Http\Controllers\Api\SalesReturnController::class, 'del']);
    Route::post('sales_return_repeal', [\App\Http\Controllers\Api\SalesReturnController::class, 'repeal']);//撤销
    Route::post('sales_return_get_money', [\App\Http\Controllers\Api\SalesReturnController::class, 'getMoney']);//收款
    Route::post('sales_return_in', [\App\Http\Controllers\Api\SalesReturnController::class, 'in']);//入库

    //发货单
    Route::post('dispatch_bill_list', [\App\Http\Controllers\Api\DispatchBillController::class, 'index']);
    Route::post('dispatch_bill_find', [\App\Http\Controllers\Api\DispatchBillController::class, 'find']);

    Route::post('dispatch_bill_add', [\App\Http\Controllers\Api\DispatchBillController::class, 'add']);
    Route::post('dispatch_bill_edit', [\App\Http\Controllers\Api\DispatchBillController::class, 'edit']);
    Route::post('dispatch_bill_del', [\App\Http\Controllers\Api\DispatchBillController::class, 'del']);
    Route::post('dispatch_bill_bind_driver', [\App\Http\Controllers\Api\DispatchBillController::class, 'bindDriver']);//绑定司机

    //审批
    Route::post('check_list', [\App\Http\Controllers\Api\CheckController::class, 'index']);
    Route::post('check_agree_or_refund', [\App\Http\Controllers\Api\CheckController::class, 'agreeOrRefund']);//同意或拒绝
    Route::post('check_out', [\App\Http\Controllers\Api\CheckController::class, 'out']);//出库

    //指的权限菜单
    Route::post('auth_menu_list', [\App\Http\Controllers\Api\AuthMenuController::class, 'index']);
    Route::post('auth_menu_edit', [\App\Http\Controllers\Api\AuthMenuController::class, 'edit']);

    //统计
    Route::post('statistics_sell', [\App\Http\Controllers\Api\StatisticsController::class, 'sell']);//已销售统计
    Route::post('statistics_sell_proceed', [\App\Http\Controllers\Api\StatisticsController::class, 'sellProceed']);//销售统计
    Route::post('statistics_cost', [\App\Http\Controllers\Api\StatisticsController::class, 'cost']);//成本统计
    Route::post('statistics_stock', [\App\Http\Controllers\Api\StatisticsController::class, 'stock']);//进货
    Route::post('statistics_tally', [\App\Http\Controllers\Api\StatisticsController::class, 'tally']);//记账

    //采购
    Route::post('add_materiel', [MaterielController::class, 'add']);//新建采购
    Route::post('edit_materiel', [MaterielController::class, 'edit']);//修改采购单
    Route::post('del_materiel', [MaterielController::class, 'del']);//删除采购
    Route::post('add_materiel_other_charges', [MaterielController::class, 'addCharges']);//添加其他费用
    Route::post('edit_materiel_other_charges', [MaterielController::class, 'editCharges']);//编辑其他费用
    Route::post('materiel_other_charges_list', [MaterielController::class, 'chargesList']);//其他费用列表
    Route::post('pay_materiel_money', [MaterielController::class, 'payMaterielMoney']);//付款
    Route::post('materiel_list', [MaterielController::class, 'list']);//采购单列表
    Route::post('cancel_materiel', [MaterielController::class, 'cancel']);//撤销
    Route::post('materiel_add_again', [MaterielController::class, 'addAgain']);//重新下单
    Route::post('materiel_detail', [MaterielController::class, 'detail']);//详细
    Route::post('materiel_in_storage', [MaterielController::class, 'materielInStorage']);//入库

    Route::get('edit_unit_price', [MaterielController::class, 'editUnitPrice']);//修改商品采购单价

    //操作记录
    Route::post('cancel_direct_instorage', [LogController::class, 'cancelDirectInstorage']);//撤销直接入库
    Route::post('storage_log_list', [LogController::class, 'list']);//操作记录列表
    Route::post('log_detail', [LogController::class, 'detail']);//操作记录详情
    Route::post('cancel_allocate', [LogController::class, 'cancelAllocate']);//调拨撤销
    Route::post('cancel_package_out', [LogController::class, 'cancelPackage']);//撤销套餐出库
    Route::post('cancel_direct_outstorage', [LogController::class, 'cancelDirectOutstorage']);//撤销直接出库
    Route::post('old_log_list', [LogController::class, 'oldLogList']);//旧操作记录列表
    Route::post('cancel_old_log', [LogController::class, 'cancelOldLog']);

    //反馈
    Route::post('feed_back_list', [\App\Http\Controllers\Api\FeedBackController::class, 'index']);
    Route::post('feed_back_add', [\App\Http\Controllers\Api\FeedBackController::class, 'add']);
    Route::post('feed_back_edit', [\App\Http\Controllers\Api\FeedBackController::class, 'edit']);
    Route::post('feed_back_del', [\App\Http\Controllers\Api\FeedBackController::class, 'del']);
});

Route::get('detail_sell_find', [\App\Http\Controllers\Api\DetailController::class, 'sellFind']);
Route::get('materiel_detail_common', [CommonDetailController::class, 'materielDetail']);//采购详细-no token
Route::get('detail_sales_return_find', [\App\Http\Controllers\Api\DetailController::class, 'salesReturnFind']);
Route::get('detail_dispatch_bill_find', [\App\Http\Controllers\Api\DetailController::class, 'dispatchBillFind']);

//详情页
Route::get('purchase', [CommonDetailController::class, 'materielDetailIndex']);
Route::get('customerSend', [CommonDetailController::class, 'customerSend']);
Route::get('sales', [CommonDetailController::class, 'sales']);
Route::get('salesReturn', [CommonDetailController::class, 'salesReturn']);
Route::get('templateCustomerSend', [CommonDetailController::class, 'templateCustomerSend']);
Route::get('dispatchBill', [CommonDetailController::class, 'dispatchBill']);
Route::get('wxPage', [CommonDetailController::class, 'wxPage']);
Route::get('verification', [CommonDetailController::class, 'verification']);

//帮助
Route::post('help_list', [\App\Http\Controllers\Api\HelpController::class, 'index']);
Route::post('help_find', [\App\Http\Controllers\Api\HelpController::class, 'find']);
Route::get('help_find/{id}', [\App\Http\Controllers\Api\HelpController::class, 'getFind']);
Route::post('help_find_safe_privacy', [\App\Http\Controllers\Api\HelpController::class, 'findSafePrivacy']);//安全隐私查询
Route::post('help_add', [\App\Http\Controllers\Api\HelpController::class, 'add']);
Route::post('help_edit', [\App\Http\Controllers\Api\HelpController::class, 'edit']);
Route::post('help_del', [\App\Http\Controllers\Api\HelpController::class, 'del']);
Route::post('help_open_time', [\App\Http\Controllers\Api\HelpController::class, 'timeCount']);//打开次数

//设置
Route::post('set_switch', [SystemConfigController::class, 'set']);//设置开关
Route::post('get_switch', [SystemConfigController::class, 'get']);//获取开关

Route::get('wx_setting', [CommonDetailController::class, 'wxSetting']);//配置微信消息推送

Route::get('storage_manage_export', [CommonController::class, 'export']);//导出库存报表
Route::get('download', [CommonController::class, 'download']);//下载库存导入模版

